﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UIWindow.Helper
{
    /// <summary>
    /// 系统设备操作相关
    /// </summary>
    public static class SystemDevices
    {
        public static long GetHardDiskFreeSpace(this string str_HardDiskName)
        {
            var drive = System.IO.DriveInfo.GetDrives().Where(x => x.Name == $"{str_HardDiskName}:\\").FirstOrDefault();
            if (drive != null) return drive.TotalFreeSpace / (1024 * 1024 * 1024);
            return 0;
        }
    }
}
